<?php

namespace app\admin\model;

use  think\Model;

class Course extends Model
{
    protected $table = "courses";
    // 定义时间戳字段名
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    //图片属于课程
    public function photo()
    {
        return $this->belongsTo('Photo');
    }

    public function tags()
    {
        return $this->belongsToMany('Tag');
    }

    public function chapters()
    {
        return $this->hasMany('Chapter');
    }
}